package br.edu.ufcg.embedded.eolica.view;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;

import br.edu.ufcg.embedded.eolica.MIDlet.UsinaEolicaMIDlet;
import br.edu.ufcg.embedded.eolica.util.Properties;

public class HelpForm extends Form implements CommandListener {

	private Command cmdBack;
	private Display d;
	private Displayable previous;
	private Properties prop;
	
	public HelpForm(Display d, Displayable previous, String help) {
		super("Eletrobras - " + help );
		this.d = d;
		this.previous = previous;
		
		prop = UsinaEolicaMIDlet.getProp();
		
		cmdBack = new Command(prop.getProperty("label.back"), Command.BACK, 0);
		addCommand(cmdBack);
		setCommandListener(this);
	}
	
	public void commandAction(Command cmd, Displayable arg1) {
		if(cmd == cmdBack)
			d.setCurrent(previous);
	}

}
